import React from 'react';
import { Box, Alert, CircularProgress } from '@mui/material';
import InfoSection from './InfoSection';
import InfoItem from './InfoItem';
import { SchoolRecommendation } from '../types';

interface SchoolRecommendationSectionProps {
    schoolRecommendation: SchoolRecommendation;
    onEdit: () => void;
    loading?: boolean;
    error?: string | null;
}

const SchoolRecommendationSection: React.FC<SchoolRecommendationSectionProps> = ({
    schoolRecommendation,
    onEdit,
    loading,
    error
}) => {
    return (
        <InfoSection title="选校推荐" onEdit={onEdit} loading={loading}>
            {error && (
                <Alert severity="error" sx={{ mb: 2 }}>
                    {error}
                </Alert>
            )}

            {loading ? (
                <Box sx={{ display: 'flex', justifyContent: 'center', p: 3 }}>
                    <CircularProgress />
                </Box>
            ) : (
                <Box className="form-grid">
                    <InfoItem label="绩点" value={schoolRecommendation.gpa} />
                    <InfoItem label="地区" value={schoolRecommendation.region} />
                    <InfoItem label="推荐结果" value={schoolRecommendation.recommendationText} />
                </Box>
            )}
        </InfoSection>
    );
};

export default SchoolRecommendationSection;
